home *** CD-ROM | disk | FTP | other *** search
/ Dino Crisis Digital Press Kit / Dino Crisis Digital Press Kit.iso / mac / Xtras / Director 6.5 Behaviors / Cursor Behavior Library.cst / 00002_Script_Rollover Animate < prev    next >
Text File  |  1998-04-19  |  4KB  |  128 lines

  1. -- Cursor Rollover Animate
  2.  
  3. ------------------------------------------------------------------------
  4. --
  5. --This behavior creates an animated cursor when you roll over the sprite it is attached to
  6. --The required parameters are:
  7. --
  8. --Animation: 
  9. --  OnMouseEnter, Animates when the mouse is over the sprite.
  10. --  OnMouseExit, Animates when the mouse is not over the sprite.
  11. --  Always, Allways animate the cursor.
  12. --  Never, Never animate.
  13. --
  14. --First cast member: The first member of the animation
  15. --
  16. --Last cast member: The last cast member of the animation
  17. --Note: This behavior creates and then deletes the cursor displayed
  18. --
  19.  
  20. -- Declare the properties used by this behavior.
  21. property pCursorMember, pStartMember, pEndMember, pAnimateFlag, pShowFlag
  22.  
  23. on beginSprite me
  24.   
  25.   -- The name of the cursor cast member crated by this sprite
  26.   put the member of sprite the spriteNum of me into myMember
  27.   
  28.   set tempName = "Cursor For Sprite " & the spriteNum of me & " Member - " & myMember
  29.   
  30.   set pCursorMember = new(#cursor)
  31.   set the name of pCursorMember = tempName
  32.   
  33.   if member tempname <> member pCursorMember then
  34.     set tempCur = pCursorMember
  35.     set pCursorMember = member tempname
  36.     erase member tempCur
  37.   end if
  38.   
  39.   put the memberNum of member pStartMember into startPoint
  40.   put the memberNum of member pEndMember into endPoint
  41.   set templist = []
  42.   
  43.   repeat with i = startPoint to endPoint
  44.     put the type of member i into tempType
  45.     if tempType = #richText then 
  46.       append tempList, member i
  47.     else if tempType = #bitmap then
  48.       if the depth of member i = 8 then
  49.         append tempList, member i
  50.       end if
  51.     end if
  52.   end repeat
  53.   
  54.   set the castMemberList of member pCursorMember = templist
  55.   
  56.   if pAnimateFlag = #Allways then
  57.     set the interval of member pCursorMember = 100
  58.   else
  59.     set the interval of member pCursorMember = -1
  60.   end if
  61.   
  62.   
  63.   cursor(member pCursorMember)
  64.   
  65.   
  66. end
  67.  
  68.  
  69. on mouseEnter me  
  70.   if pAnimateFlag = #OnMouseEnter then
  71.     cursor member pcursormember
  72.     set the interval of member pCursorMember = 100
  73.   else  if pAnimateFlag = #OnMouseExit then
  74.     set the interval of member pCursorMember = -1
  75.   end if
  76. end
  77.  
  78. on mouseLeave me  
  79.   if pAnimateFlag = #OnMouseEnter then
  80.     set the interval of member pCursorMember = -1
  81.   else   if pAnimateFlag = #OnMouseExit then
  82.     cursor member pcursormember
  83.     set the interval of member pCursorMember = 100
  84.   end if 
  85. end
  86.  
  87. on endSprite me
  88.   erase member pCursorMember
  89. end
  90.  
  91.  
  92. -- The following handlers set up behaviors for the
  93. -- behavior inspector.
  94.  
  95. on getPropertyDescriptionList
  96.   set p_list = [ ¨
  97.     #pAnimateFlag:[ #comment:  "Animation:", ¨
  98.                     #format:   #symbol, ¨
  99.                     #range:    [#Always, #OnMouseEnter, #OnMouseExit, #None ],¨
  100.                     #default:  #OnMouseEnter], ¨
  101.   #pStartMember:[ #comment:  "First cast member:", ¨
  102.                     #format:   #member, ¨
  103.                    #default:   "member 1 of castlib 1"], ¨
  104.      #pEndMember:[ #comment:     "Last cast member:", ¨
  105.                     #format:   #member, ¨
  106.                    #default:   "member 1 of castlib 1"] ¨
  107.                ]
  108.   return p_list    
  109. end
  110.  
  111.  
  112. -- The following text is displayed in the Behavior Inspector 
  113. -- when this behavior is selected
  114.  
  115. on getBehaviorDescription
  116.   return ¨
  117. "This behavior creates an animated cursor when you roll over the sprite it is attached to" & Return & ¨
  118. "The required parameters are:" & return & return &¨
  119. "Animation: " & return & ¨
  120. "  OnMouseEnter, Animates when the mouse is over the sprite." & return &¨
  121. "  OnMouseExit, Animates when the mouse is not over the sprite." & return &¨
  122. "  Always, Always animate the cursor." & return &¨
  123. "  Never, Never animate." & return & return &¨
  124. "First cast member: The first member of the animation" & return & ¨
  125. "Last cast member: The last cast member of the animation" & return & ¨
  126. "Note: This behavior creates and then deletes the cursor member displayed"
  127. end
  128.